fix deprecated-copy waring. (#675)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Tue, 2 Feb 2021 13:07:41 +0000 (06:07 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Feb 2021 13:07:41 +0000 (06:07 -0700)
commit37f260f5b43ff6e2a79f2bb9d7d74caec88e7f67
tree08633607c5eb173118d6f3a1e53b61097cb16b79
parent89ac4774852f47ce8ce6181e241e5af83dce3ff5
fix deprecated-copy waring. (#675)

This fixes
"formatload.cc:127:40: warning: implicitly-declared
 ‘Format& Format::operator=(const Format&)’ is deprecated [-Wdeprecated-copy]"

Use default member initializers for FormatOption and Format classes.
This allows the use of the default constructor and simplifies the
creation of parameterized constructors.

Use implicit copy constructor for FormatOption and Format classes.
Note the previous copy constructor for the Format class was not
really a copy constructor, it re-initialized readUseCount and writeUseCount.
This was unnecessary.  The only place we want to use the copy constructor is
in FormatLoad::getFormats and the instances to be copied have just been
created with one of the Format constructors so the use counts will be zero.
There are plenty of other opportunities where Qt might detach formatList_
and use the copy constructor.  Most of these cases are read accesses and
improved const correctness could eliminate the possiblity, i.e. using
QList::at instead of QList::operator[].  A few of these are modifying an
item on the formatList_, and Qt will insist the copy constructor is available
at compile time even if it is never used at run time.
gui/format.h